package com.you.redis.set;

import com.you.redis.util.JedisUtils;
import redis.clients.jedis.Jedis;

/**
 * 使用jedis测试set集合的数据类型
 */
public class RedisSetDemo {

    public static void main(String[] args) throws Exception {
        Jedis jedis = JedisUtils.getInstance().getJedis();
        //存放数据
        jedis.sadd("users", "libai");
        jedis.sadd("users", "huahua");
        System.out.println(jedis.smembers("users"));//获取加入的value值
        System.out.println(jedis.sismember("users", "libai"));//判断user 是否某个值
        System.out.println(jedis.scard("users")); //返回个数

        System.out.println(jedis.srem("users", "libai")); //移除
        System.out.println(jedis.smembers("users"));

    }
}
